﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Navigation;
using WRS.Data;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace WRS
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class BlankPage : Page
    {
        public BlankPage()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //var sampledata = new SampleDataSource();



            var sampleData = new SampleDataSource();
       
            this.Frame.Navigate(typeof(Page2), sampleData.ItemGroups);

            //Window.Current.Content = rootframe;
            //Window.Current.Activate();
        }

        private void Background_Loaded(object sender, RoutedEventArgs e)
        {
            if (DateTime.Now.Hour >= 6 && DateTime.Now.Hour < 12)
            {
                ImageBrush bg = new ImageBrush();
                bg.ImageSource = new BitmapImage(new Uri("ms-appx:/Assets/Morning.png", UriKind.Absolute));
                Background.Background = bg;
            }
            else if (DateTime.Now.Hour >= 12 && DateTime.Now.Hour < 18)
            {
                ImageBrush bg = new ImageBrush();
                bg.ImageSource = new BitmapImage(new Uri("ms-appx:/Assets/Noon.png", UriKind.Absolute));
                Background.Background = bg;
            }
            else
            {
                ImageBrush bg = new ImageBrush();
                bg.ImageSource = new BitmapImage(new Uri("ms-appx:/Assets/Night.png", UriKind.Absolute));
                Background.Background = bg;
            }
        }
    }
}
